﻿<UserControl x:Class="wfDesigner.FlowTypeControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"  
             xmlns:lib="clr-namespace:CustomControlLibrary;assembly=CustomControlLibrary"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300" Height="530" Width="770">
    <Grid Width="770" Name="Grid1">
        <Grid.RowDefinitions>
            <RowDefinition Height="60*" />
            <RowDefinition Height="51*" />
            <RowDefinition Height="383*" />
            <RowDefinition Height="36*" />
        </Grid.RowDefinitions>
        <Label Content="流程类型管理" Grid.Row="0" Height="34" HorizontalAlignment="Left" Margin="20,18,0,0" Name="label1" VerticalAlignment="Top" Width="167" FontSize="18" FontStyle="Normal" />
        <Button Content="添加" Grid.Row="1" Height="26" HorizontalAlignment="Left" Margin="28,12,0,0" Name="Addbtn" VerticalAlignment="Top" Width="94" Click="Addbtn_Click" />
        <Button Content="编辑" Height="26" HorizontalAlignment="Left" Margin="141,12,0,0" Name="Editbtn" VerticalAlignment="Top" Width="94" Grid.Row="1" Click="Editbtn_Click" />           
     
        <Button Content="删除" Height="26" HorizontalAlignment="Left" Margin="265,12,0,0" Name="Delbtn" VerticalAlignment="Top" Width="94" Grid.Row="1" >
            <i:Interaction.Triggers>
                <i:EventTrigger EventName="Click">
                    <i:InvokeCommandAction Command="{Binding Delete}" CommandParameter="{Binding ElementName=PageGrid,Path=SelectedIndex}" >
                    </i:InvokeCommandAction>
                </i:EventTrigger>
            </i:Interaction.Triggers>
        </Button>
        <DataGrid  AutoGenerateColumns="False"  ItemsSource="{Binding Path=TypeList,Mode=TwoWay}" Grid.Row="2" SelectedItem="{Binding Path=SelItem,Mode=TwoWay}" SelectedIndex="{Binding Path=SelIndex,Mode=TwoWay}" Name="PageGrid">
            <DataGrid.Columns  >                
                <DataGridTextColumn  Header="序号"  Binding="{Binding ID}"  />
                <DataGridTextColumn Header="进程类型"  Binding="{Binding TypeName}"  />
                <DataGridTextColumn Header="备注"  Binding="{Binding TypeRemark}" />
                <DataGridTextColumn Header="创建时间"  Binding="{Binding DateTime}"/>
            </DataGrid.Columns>
        </DataGrid>

        <lib:DataPager Grid.Row="3" Name="dataPager" PageSizeList="10,20,30 "
                       ItemsSource="{Binding Path=TypeList,Mode=TwoWay}"
                       PageSize="{Binding Path=PageSize,Mode=TwoWay}"
                        Total="{Binding Path=Total}"
                       PageIndex="{Binding Path=PageIndex,Mode=TwoWay}"
                       PageChanged="dataPager_PageChanged" />
    </Grid>
</UserControl>
